﻿<extend name="Common/public"/>

<block name="content">
<title>添加用户</title>
</head>
<body>
<div class="pd-20">
  <form action="" method="post" class="form form-horizontal" id="form-member-add" enctype="multipart/form-data">
    <div class="row cl">
      <label class="form-label col-3">排序：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="<empty name='photo'>0<else/>{$photo['sort']}</empty>" placeholder="" id="member-name" name="sort">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3">图片：</label>
      <div class="formControls col-5"> <span class="btn-upload form-group">
        <input class="input-text upload-url" type="text" name="uploadfile-2" id="uploadfile-2" readonly value="{$photo['image']}" datatype="*" nullmsg="请选择图片！" style="width:200px">
        <a href="javascript:void();" class="btn btn-primary radius upload-btn"><i class="Hui-iconfont">&#xe642;</i> 选择图片</a>
        <input type="file" multiple name="logo" class="input-file">
        </span> </div>
      <div class="col-4"> </div>
    </div>
    <notempty name="photo">
    <div class="row cl">
      <label class="form-label col-3"></label>
      <div class="formControls col-5">
      	<img src="{$photo['image']}" style="max-height: 120px;max-width: 120px;"/>
      </div>
      <div class="col-4"> </div>
    </div>
   	</notempty>
    <input type="hidden" name="goods_id" value="{$Think.get.goods_id}"/>
    
    <notempty name="photo">
    <input type="hidden" name="photo_id" value="{$photo['id']}"/>
    </notempty>
    
    <div class="row cl">
      <div class="col-9 col-offset-3">
        <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
      </div>
    </div>
  </form>
</div>
</div>

<include file="Common/js"/>
<script src="http://malsup.github.io/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-member-add").Validform({
		tiptype:2,
		ajaxPost:true,
		beforeSubmit:function(){
			$("#form-member-add").ajaxSubmit({
				type:'post',
				url:"{:U('photoAdd')}",
				success:function(data){
					if(data.status == 1){
						layer.msg('成功',{icon:6,time:1000});
						setTimeout(function(){
							var index = parent.layer.getFrameIndex(window.name);
							parent.location.reload();
							parent.layer.close(index);
						},1000);
					}else{
						layer.msg(data.msg,{icon:5,time:1000});
					}
				}
			});
			return false;
		}
	});
});
</script>
</body>
</block>